import java.util.*;
public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param S string字符串 
     * @param T string字符串 
     * @return bool布尔型
     */
    public boolean isSubsequence (String S, String T) {
        // write code here
        Queue<Character> queue1 = new LinkedList<>();
        Queue<Character> queue2 = new LinkedList<>();

        for (int i = 0; i < S.length(); i++) {
            queue1.offer(S.charAt(i));
        }
        for (int i = 0; i < T.length(); i++) {
            queue2.offer((T.charAt(i)));
        }
        while(!queue2.isEmpty() && !queue1.isEmpty()) {
            if(queue1.peek() == queue2.peek()) {
                queue1.poll();
                queue2.poll();
            }else {
                queue2.poll();
            }
        }
        if(queue1.isEmpty()) {
            return true;
        }else {
            return false;
        }

    }

    public static void main1(String[] args) {
        Solution solution = new Solution();
        String S = "nowcoder";
        String T = "nowcoder";
        boolean ret = solution.isSubsequence (S, T);
        System.out.println(ret);
    }
    public static char[] clearSame(String s) {
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < s.length(); i++) {
            char a = s.charAt(i);
            if(stack.isEmpty()) {
                stack.push(a);
                continue;
            }
            if(stack.peek() == a) {
                stack.pop();
                continue;
            }
            stack.push(a);
        }
        if(stack.isEmpty()) {
            return null;
        }
        char[] array = new char[stack.size()];
        int j = array.length-1;
        while(!stack.isEmpty()) {
            array[j] = stack.pop();
            j--;
        }
        return array;
    }

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        //String s = "abbc";
        char[] array = clearSame(s);
        if(array== null) {
            System.out.println(0);
        }else {
            for(char a : array) {
                System.out.print(a);
            }
        }
    }
}